Zhaoxin SMBUS Linux Driver Release Note

2020-05-08


Support Platforms

Notices

How to install & uninstall

SMBus access example

Device driver access example

Limitations

Revision History


Support Platforms

Hardware:

SMBus version 0 ~ 0x10

 

Kernel Version:  

Kernel version supported by this driver is linux-3.0.1 ~ latest

 Back to top


Notices

Zhaoxin SMBus Linux driver support all protocols specified in the SMBus Specification 2.0 and limited support for I2C protocol. The protocols listed in the followed table. However, for our board, only Read/Write Byte, Read/Write Word, Read/Write Block, can been tested, because the device connected to the SMBus in the board only support the protocol specified above. If want to test the other protocol, you should connect the device supporting the protocol to the SMBus in the board.

 

Protocol Name

Description

Read Quick

Reads from a device but returns no data.

Write Quick

Writes to a device, returning no data.

Send Byte

Sends one byte of data to a device.

Receive Byte

Receive one byte of data from the device.

Read Byte

Read a byte from an SMB device.

Write Byte

Write a byte to an SMB device.

Read Word 

Read a word from an SMB device.

Write Word 

Write a word to an SMB device.

Read Block

Reads up to AP specified count of bytes from an SMB device.

Write Block 

Writes up to AP specified count of bytes to an SMB device.

Process Call

Combines functions of Read Word and Write Word.

Allow a device to return a value that depends on the value input.

IIC protocol

Support up to two I2C msgs access.

SMBALERT#

A slave-only device can signal the host through SMBALERT# that it wants to talk.

Back to top


How to install & uninstall

Build driver

Before installing the driver for the first time, it should been compiled once:

    # cd ./src/

    # sudo make

 

Install driver

Use the followed commands to install:

# cd ./src/

# sudo make install

    If the installation is successful, device node /dev/i2c-0 can be listed.

 

Uninstall driver

Use the followed commands to uninstall:

# cd ./src/

# sudo make uninstall

 

Clean old files

Use the followed commands to clean:

# cd ./src/

# sudo make clean

 

Back to top


SMBus access example

Install i2c-tools

A.     Directly use apt command to install

# sudo apt-get install i2c-tools

 

B.     Use soure code to install

Download soure code from https://mirrors.edge.kernel.org/pub/software/utils/i2c-tools/

After decompression, use command “make” & “make install” to install. See its readme for details

 

Use i2cdetect list adapter and deivce

A.     adapter detect, for exmple:

# i2cdetect -l

i2c-0   i2c             Zhaoxin-SMBus                           I2C adapter

 

B.     device detect, for exmple:

# i2cdetect -y -r 0

        0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: 30 -- -- -- -- -- -- -- 36 -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- -- --

 

Use i2cget to get values

Use the followed commands to get, for exmple:

# i2cget -y 0 0x51 64

0x16

 

Use i2sget to set values

Use the followed commands to set, for exmple:

# i2cset -y 0 0x51 0x23 5

 

For SPD EEPROM, use i2cset to select BANK

Use the followed commands to select BANK0:

# i2cset -y 0 0x36 0 0

 

Use the followed commands to select BANK1:

# i2cset -y 0 0x37 0 0

 

Notes: For more use about i2c-tools, read its help please.

 

Back to top


Device driver access example

       Most PC have a SPD on the DDR3/DDR4, here is an example to use device driver 'at24' to access this SPD.

Load device driver

# modprobe at24

Bound device to adapter

# echo spd 0x51 > /sys/bus/i2c/devices/i2c-0/new_device

Read data from SPD by 'dd' command

# dd if=/sys/bus/i2c/devices/0-0051/eeprom of=./result.data count=16 bs=1

# hexdump result.data

0000000 1123 020c 1984 0800 0000 0300 0309 0000

0000010

 

Back to top


 

Limitations   

       For IIC access, one messge access support both write and read; two messges access only support first write then read. Biggest access number is 32 bytes.

Back to top


Revision History

Version

Release Date

Comments

V1.0.0

2017-03-02

This is the first driver release.

V1.1.0

2018-11-13

Adjusted protocol process.

V1.2.0

2018-12-04

Change to an independent driver.

V1.3.0

2019-03-13

Add IIC access function. Delete debug codes. Add Use Example in release note.

V2.0.0

2019-07-05

Framework adjustments have been made and removed alert function

V2.0.1

2019-08-09

add support for SMBus v02, add version id check

V2.0.2

2020-05-08

add support for SMBus v10, add process about SMBALERT function

 Back to top


V2.0.2

Add support for SMBus v10, add process about SMBALERT function.

 

Back to top